package top.yehot.kettle.boot.core;

import java.util.Arrays;
import java.util.List;
import java.util.Map;
import java.util.concurrent.ConcurrentHashMap;
import java.util.stream.Collectors;

import org.pentaho.di.core.database.DatabaseMeta;
import org.pentaho.di.repository.AbstractRepository;
import org.pentaho.di.repository.RepositoryObjectType;

/**
 * 常量类
 * 
 * @author lquan
 * @date 2022年5月29日 下午4:31:27
 */
public class SysConst {

	/**
	 * kettle版本
	 */
	public static final String VERSION = "9.1";
	
	/**
	 * 资源库数据后缀
	 */
	public static final String REP_DB_SUFFIX = "_db";
	
	/**
	 * 资源库缓存
	 */
	public static final Map<String, AbstractRepository> REP_DATABASE = new ConcurrentHashMap<>();
	
	/**
	 * 资源库连接数据库缓存（资源库连接哪些数据库）
	 */
	public static final Map<String, List<DatabaseMeta>> REP_DB_INFOS = new ConcurrentHashMap<>();
	
	/**
	 * 脚本类型枚举
	 */
	public static final Map<String, String> scriptTypeMap = Arrays.asList(RepositoryObjectType.values()).stream()
					.collect(Collectors.toMap(RepositoryObjectType::getTypeDescription, RepositoryObjectType::getExtension, (k1, k2) -> k1));
	
	/* quart设置-开始 */
	public static final String QUARTZ_TRIGGER = "_trigger";
	public static final String QUARTZ_TRIGGER_GROUP = "kettle_trigger_group";
	public static final String QUARTZ_JOB = "_job";
	public static final String QUARTZ_JOB_GROUP = "kettle_job_group";
	/* quart设置-结束 */
	
	/**
	 * 任务执行时取任务ID对应KEY
	 */
	public static final String TASK_ID = "taskId_key";
	
	/**
	 * 任务执行时取日志文件地址对应KEY
	 */
	public static final String TASK_LOG = "logFilePath_key";
	
	/**
	 * 任务执行时取日志记录ID地址对应KEY
	 */
	public static final String TASK_RECORD_ID = "TASK_RECORD_ID";
	
}
